﻿import pygame

class Scene(pygame.sprite.RenderPlain):
	
	def __init__(self,eventManager,backSurface,objects):
		self.backSurface = backSurface
		self.eventManager = eventManager
				
		super(Scene,self).__init__()
		
		for obj in objects:
			self.__setattr__(obj.id,obj)
			self.add(obj)
		
	def get_size(self):
		return self.backSurface.get_size()
		
	def get_surface(self):
		return self.backSurface
	
	def draw(self):
		for spr,index in self.spritedict.items():
			if spr.is_visible():
				self.backSurface.blit( spr.image,spr.rect )
				
	def fireEvent(self,event):
		self.eventManager.fireEvent(self,event)
				
class GameObject(pygame.sprite.Sprite):
	
	def __init__(self,id):
		self.id = id
		self._is_visible = True
		super(GameObject,self).__init__()
		
		self.unit = None
	
	def is_visible(self):
		return self._is_visible
		
	def get_unit(self):
		return unit

class EventManager():

	def fireEvent(self,scene,event):
		pass